package com.qf.student.controller;


import com.qf.student.response.R;
import com.qf.student.service.IDepartmentService;
import com.qf.student.utils.TokenUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2022-11-21
 */
@RestController
@RequestMapping("/department")
public class DepartmentController {

    @Autowired
    private IDepartmentService departmentService;

    @RequestMapping("/getDepartmentById/{teacherId}")
    public R getDepartmentById(@PathVariable("teacherId") Integer teacherId, HttpServletRequest request) {
        Integer userId = TokenUtils.getUserId(request);
        return departmentService.getDepartmentById(teacherId, userId);
    }


}
